import 'dart:convert';
import 'dart:developer';
import 'package:http/io_client.dart';
import 'package:pure/model.dart';

// final engine = CronetEngine.build(
//         cacheMode: CacheMode.memory,
//         cacheMaxSize: 2 * 1024 * 1024,
//         userAgent: 'Book Agent');
//     httpClient = CronetClient.fromCronetEngine(engine, closeEngine: true);

class HRequest {
  static final _client = IOClient();

  static Future<Res> getVodList(String base, {int page = 1}) async {
    final url = "$base?ac=detail&pg=$page";
    log('request: $url');
    final res = await _client.get(Uri.parse(url));
    final map = jsonDecode(res.body);
    final r = Res()..fromMap(map);
    return r;
  }
}
